<template>
  <div id="root">
   <button @click="isShow = !isShow">显示|隐藏</button>
   <!-- :appear="true"或appear，页面进入就展示动画 -->
   <transition name="showtransition" :appear="true">
        <h1 v-show="isShow" class="com">显示</h1>
   </transition>
  </div>
</template>

<script>

export default {
    name:"Test",
    data(){
        return{
            isShow:true
        }
    },
}

</script>

<style scoped>
h1{
    background:lightBlue;
}
/* 命名规定，默认是v，如果transition命了名，主题就用命了名的name*/
/* .v-enter-active{ */
.showtransition-enter-active{
    animation:h1move 1s linear;
}
/* .v-leave-active{ */
.showtransition-leave-active{
    animation:h1move 1s reverse;
}
@keyframes h1move{
    from{
        transform:translateX(-100%);
    }
    to{
        transform:translateX(0px)
    }
}

</style>
